package com.dongdong.controller;

import com.dongdong.em.Result;
import com.dongdong.model.TbItem;
import com.dongdong.service.ItemService;
import com.dongdong.vo.ItemVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("item")
@RefreshScope   //热更新
public class ItemController {

    @Autowired
    private ItemService itemService;

    @GetMapping("getIemBySKUId")
    public Result getIemBySKUId(@RequestParam Long skuid){
        ItemVO itemVO = itemService.getIemBySKUId(skuid);
        return Result.OK().setData(itemVO);
    }

    @PostMapping("subStockCount")
    public Result subStockCount(@RequestBody List<TbItem> kc){
        itemService.subStockCount(kc);
        return Result.OK();
    }
}
